package jetpack.com.pzl.architecture;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

/**
 * fragment 之间共享数据
 */
public class SharedViewModel extends ViewModel {
    private final MutableLiveData<ItemInfo> selected = new MutableLiveData<ItemInfo>();

    public void selectSet(ItemInfo item) {
        selected.setValue(item);
    }

    public LiveData<ItemInfo> getData() {
        return selected;
    }

    @Override
    protected void onCleared() {
    }
}
